package com.neo4j.neo4jcloud.controller;

import com.neo4j.neo4jcloud.entity.GraphIn;
import com.neo4j.neo4jcloud.service.GraphInService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author kabuqinuo
 * @date 2020/3/27 16:12
 */
@RestController
@RequestMapping(value = "/graphIn")
public class GraphInController {

    @Autowired
    private GraphInService graphInService;

    @GetMapping
    public ResponseEntity<GraphIn> findAllGraphIn(HttpServletRequest request, HttpServletResponse response){
        return ResponseEntity.ok(graphInService.findGraphInMoreByAll());
    }

    @GetMapping("/findByNodeId")
    public ResponseEntity<GraphIn> findAllGraphIn(HttpServletRequest request, @RequestParam(value = "nodeId") String nodeId,
                                                  HttpServletResponse response){
        return ResponseEntity.ok(graphInService.findGraphInMoreByNodeId(nodeId));
    }
}
